package com.a3dweijing.wetouch2.network;

import android.app.AlertDialog;
import android.content.Context;
import android.support.annotation.Nullable;
import android.view.View;

import com.a3dweijing.wetouch2.Common.CallBack;

import java.util.ArrayList;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by Administrator on 2018/4/8.
 */

public  class Commsubscribe<T>
{
    
    public void createSubscribe(Observable<T> observable, @Nullable View view1, @Nullable View view2,
                                @Nullable ArrayList<Disposable> ds, Context context, CallBack callBack)
    {
        observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(
            new CommObserver<T>(null, view1, view2, ds, callBack,context));
    }
    
    public void createSubscribe(Observable<T> observable, @Nullable AlertDialog dialog, @Nullable View view2,
                                @Nullable ArrayList<Disposable> ds,  Context context,CallBack callBack)
    {
        observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(
            new CommObserver<T>(dialog, null, view2, ds, callBack,context));
    }


}
